
function swiper() {
	var mySwiper = new Swiper('.swiper-container', {
		autoplay: 2000, //可选选项，自动滑动
		height: 400,
//		width:' 100%',
		pagination : '.swiper-pagination',
		paginationElement : 'span',
		autoplayDisableOnInteraction : false,
			//pagination : '#swiper-pagination1',
	})
}

var index = {
	bannerList: function() {
		Api.bannerList({
			"pcPhoneType": 1,
			"type": 0
		}, function(data) {
			// console.log(data);
			var html = "",
				datas = data.data;
				if(datas.length>5){
					datas.length=5;
				}
			for(var i = 0, len = datas.length; i < len; i++) {
				html += '<div class="swiper-slide"> <a href ="' + datas[i].linkUrl + '"><img src ="' + datas[i].srcUrl + '" alt="UTObanner"></a></div>';
			}
			$("#banners").html(html);
			swiper();
		})
	},
	// 获取品牌活动
	activityList: function() {

		Api.newsList({
			"pageNo": 1,
			"pageSize": 3,
			"type": 3
		}, function(data) {

			$("#activeNewstmpl").tmpl(data.data.newsList).appendTo('#activeNews');

		});
	},
	// 获取企业新闻
	companyList: function() {

		Api.newsList({
			"pageNo": 1,
			"pageSize": 3,
			"type": 2
		}, function(data) {

			$("#companyNewsTmpl").tmpl(data.data.newsList).appendTo('#companyNews');

			//          $("#activities_Plate").tmpl(data.data.newsList).appendTo('#activitiesPlate');
		});
	},
	init: function() {
		this.bannerList();
		this.activityList();
		this.companyList();
	}
}

$(function() {
	index.init();
})